function search(nums: number[], target: number): number {
    const map = new Map();
    for (let i = 0; i < nums.length; i++){
        if (nums[i] > target) {
            break;
        }
        map.set(nums[i],(map.get(nums[i]) || 0) + 1)
    }
    return map.get(target) || 0;
};